package com.activiti.tool;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Deployment;

/**
 * 流程定义部署（读取BPMN流程图）
 * 总共操作的表包括：
 * select * from ACT_RE_PROCDEF;
 * select * from ACT_RE_DEPLOYMENT;
 * select * from ACT_GE_BYTEARRAY;
 * select * from act_ge_property;
 * @author ldanniel
 */
public class ProcessDeployment {
    public static void main(String[] args) {
        //创建
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        //获取RepositoryService
        RepositoryService repositoryService = processEngine.getRepositoryService();
        //使用Service进行流程部署，定义一个流程名称，把bpmn和png部署到数据中
        Deployment deployment = repositoryService.createDeployment()
                .name("出差申请流程")
                .disableSchemaValidation() //禁用架构验证
                .addClasspathResource("bpmn/evection.bpmn")
                .deploy();

        System.out.println("流程部署的id = " +deployment.getId());
        System.out.println("流程部署的名称 = " +deployment.getName());

    }

}
